package com.liaoxuefeng.java_thread;

import java.util.Arrays;

public class TestArrays {

    public static void main(String[] args) {

        /*int[] ns = {28, 12, 89, 73, 65, 18, 96, 50, 8, 36};
        System.out.println("排序前: " + Arrays.toString(ns));
        for (int i = 0; i < ns.length - 1; i++) {
            for (int j = 0; j < ns.length - i - 1; j++) {
                if (ns[j] < ns[j + 1]) {
                    int temp = ns[j];
                    ns[j] = ns[j + 1];
                    ns[j + 1] = temp;
                }
            }
        }
        System.out.println("排序后: " + Arrays.toString(ns));*/

        int[][] scores = {
            { 82, 90, 91 },
            { 68, 72, 64 },
            { 95, 91, 89 },
            { 67, 52, 60 },
            { 79, 81, 85 },
        };
        // TODO:
        double average = 0;
        System.out.println(average);
        int totalScore = 0;
        int totalNum = 0;
        for (int[] temp : scores) {
            for (int score : temp) {
                totalScore += score;
                totalNum ++;
            }
        }
        average = (double) totalScore / (double)totalNum;
        System.out.println("所有学生的平均分 totalScore / totalNum"  + totalScore + " totalScore / totalNum" + totalNum + "=" + average);
    }
}
